package com.blog.boot.webapp.controller.index;

import com.blog.boot.api.common.RestMsg;
import com.blog.boot.api.entity.UserEntity;
import com.blog.boot.webapp.controller.common.BaseController;
import com.blog.boot.webapp.utils.ShiroUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by ChenJie on 2018/12/22.
 */
@Controller
public class MessageController extends BaseController {

    /**
     * 模拟消息
     * @return
     */
    @RequestMapping("/message/nums")
    @ResponseBody
    public RestMsg messageNum(){
        RestMsg msg = restFactory.getMsg();
        UserEntity user = ShiroUtils.getUser(UserEntity.class);
        msg.put("count",2);
        return msg;
    }

    /**
     * 读消息
     */
    @RequestMapping("/message/read")
    @ResponseBody
    public RestMsg messageRead(){
        RestMsg msg = restFactory.getMsg();
        /*
        * 这里再次检查是否有未读消息
        * */
        return msg;
    }
}
